<template>
  <div class="app-container">

    <basic-query-form ref="queryForm" @doQuery="getList"  @resetQuery="getList" :dept-type="2" :no-programme="true" :no-dept="true">
      <template v-slot:queryItem="data">
        <el-form-item label="方案名称" >
          <el-input
            v-model="data.queryParams.programmeName"
            placeholder="请输入方案名称"
            clearable
            size="small"
          />
        </el-form-item>

        <el-form-item label="考核方案模式">
          <el-select v-model="data.queryParams.pattern"  placeholder="请选择" clearable size="small" >
            <el-option
              v-for="item in patterns"
              :key="item.dictValue"
              :label="item.dictLabel"
              :value="item.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
      </template>
    </basic-query-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['kh:programme:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['kh:programme:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['kh:programme:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['kh:programme:export']"
        >导出</el-button>
      </el-col>
    </el-row>

    <el-table v-loading="loading" :data="programmeList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
<!--      <el-table-column label="id" align="center" prop="id" />-->
      <el-table-column label="方案名称" align="center" prop="programmeName" />
<!--      <el-table-column label="分数优秀区间" align="center" prop="scoreInterval" />-->
<!--      <el-table-column label="优秀比例" align="center" prop="excellentRatio" />-->
<!--      <el-table-column label="方案名称" align="center" :show-overflow-tooltip="true">-->
<!--        <template slot-scope="scope">-->
<!--          <router-link :to="'/khindex/index/' + scope.row.id" class="link-type">-->
<!--            <span>{{ scope.row.programmeName }}</span>-->
<!--          </router-link>-->
<!--        </template>-->
<!--      </el-table-column>-->

      <el-table-column label="考核名称" align="center" prop="assessmentName" />
      <el-table-column label="考核方案模式" :formatter="patternFormat" align="center" prop="pattern" />
      <el-table-column label="打分说明" align="center" prop="explainText" width="400px"/>
      <el-table-column label="操作" align="center" width="300px">

        <template slot-scope="scope">

          <el-row>
            <router-link style="margin-right: 10px" v-if="scope.row.pattern === 1 || scope.row.pattern === 3" :to="'/khPerson/index/' + scope.row.assessmentId +  '/'+ scope.row.id" class="link-type">
              <span>考核对象管理</span>
            </router-link>
            <el-button
              style="margin-right: 10px"
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="setExcellentNum(scope.row)"
              v-hasPermi="['kh:programme:edit']"
              v-if="scope.row.pattern === 0 || scope.row.pattern === 1"
            >优秀人数</el-button>
          </el-row>


          <el-row>
            <router-link style="margin-right: 10px" :to="'/khindex/index/programmeIndex/' + scope.row.id" class="link-type">
              <span>查看已有指标</span>
            </router-link>

            <el-button
              style="margin-right: 10px"
              size="mini"
              type="text"
              icon="el-icon-plus"
              @click="addIndex(scope.row)"
              v-hasPermi="['kh:programme:edit']"
            >可添加指标</el-button>
          </el-row>

         <el-row>
           <el-button
             style="margin-right: 10px"
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['kh:programme:edit']"
           >修改</el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['kh:programme:remove']"
           >删除</el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-view"
             @click="yulan(scope.row)"
           >预览</el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-view"
             @click="doStatistic(scope.row)"
           >计算</el-button>
         </el-row>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getListByQueryForm"
    />

    <!-- 设置优秀人数对话框 -->
    <el-dialog title="设置优秀数量" :visible.sync="excellentOpen" width="600px" append-to-body :close-on-click-modal="false">
      <el-form ref="form"  label-width="200px">

        <el-form-item label="设置优秀部门数量"  v-if="patternForExcellentNum === 0" >
          <el-input-number v-model="excellentPattern0"   @change="handleExcellentPattern0Change" :min="1" :max="10"
          ></el-input-number>
        </el-form-item>


        <el-form-item :label="item.deptName" v-for="item in deptForExcellentNum" v-if="patternForExcellentNum === 1" >
          <el-input-number v-model="item.excellentPattern1"  :min="1" :max="10"

          ></el-input-number>
        </el-form-item>



      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormForExcellentNum">确 定</el-button>
        <el-button @click="cancelForExcellentNum">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 添加或修改考核方案对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">

        <el-form-item label="所属考核计划">
          <el-select style="width: 100%" v-model="form.assessmentId"  placeholder="请选择" v-bind:disabled="form.id != undefined">
            <el-option
              v-for="item in AssessmentOptions"
              :key="item.value"
              :label="item.name"
              :value="item.value"
            ></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="方案名称" prop="programmeName">
          <el-input style="width: 100%" v-model="form.programmeName" placeholder="请输入方案名称" />
        </el-form-item>

        <el-form-item label="考核方案模式">
          <el-select @change="khfa(form.pattern)" style="width: 100%" v-model="form.pattern"  placeholder="请选择" v-bind:disabled="form.id != undefined">
            <el-option
              v-for="dict in patterns"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="parseInt(dict.dictValue)"
            ></el-option>
          </el-select>
        </el-form-item>

<!--        <el-form-item label="分数优秀区间" prop="scoreInterval">-->
<!--          <el-input style="width: 100%" v-model="form.scoreInterval" placeholder="请输入分数优秀区间" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="优秀比例" prop="excellentRatio">-->
<!--          <el-input style="width: 100%" v-model="form.excellentRatio" placeholder="请输入优秀比例" />-->
<!--        </el-form-item>-->

        <el-form-item label="打分说明" prop="explainText">
          <el-input style="width: 100%" v-model="form.explainText" placeholder="请输入打分说明" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>



    <!-- 可添加考核指标 对话框 -->
<!--    @selection-change="handleSelectionChangeIndex"-->
    <el-dialog :title="title" :visible.sync="indexOpen" width="1000px" append-to-body>
      <el-table :data="indexList"  >
<!--        <el-table-column type="selection" width="55" align="center" />-->
<!--        <el-table-column label="id" align="center" prop="id" />-->
        <el-table-column label="指标名称" align="center" prop="indexName" />

        <el-table-column label="指标类型"  :formatter="dictDataFormat" align="center" prop="indexType" />
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">

            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="addIndexProgramme(scope.row)"
              v-hasPermi="['kh:programme:edit']"
            >加入方案</el-button>
          </template>
        </el-table-column>
      </el-table>

      <pagination
        v-show="indexTotal>0"
        :total="indexTotal"
        :page.sync="indexQueryParams.pageNum"
        :limit.sync="indexQueryParams.pageSize"
        @pagination="addIndexPage"
      />

      <div slot="footer" class="dialog-footer">
<!--        <el-button type="primary" @click="">确 定</el-button>-->
        <el-button @click="indexCancel">取 消</el-button>
      </div>
    </el-dialog>

<!--    预览-->
    <el-dialog
      :title="youname"
      :visible.sync="dialogYLshow"
      width="900px" >

      <div style="max-height: 700px;overflow: auto" v-show="lingdaoShow">
        <table border="1" rules="all" class="tablestyle" v-show="tableData" >
          <tr >
            <td  v-for="item in listLabel" v-html="item.name"></td>
          </tr>
          <tr v-for="(item,liexb) in tableData">
            <td  v-for="(itemx,dianxb) in item">
              <span  style="color: rebeccapurple" v-show="!itemx.deptId && itemx.value!='' && !itemx.totalScore"  > {{itemx.value}}</span>
              <span  v-show="itemx.value=='' && !itemx.totalScore" > 打分</span>
              <span v-show="itemx.deptId"> {{itemx.value}}</span>
              <span v-show="itemx.totalScore">
              <span v-show="itemx.value>'0' && itemx.value<'100'"> {{itemx.value}}</span>
              <span style="color: red;" v-show="itemx.value=='0' || itemx.value=='100'"> {{itemx.value}}</span>
            </span>

            </td>
          </tr>
        </table>
      </div>

      <div class="divbody" v-show="xunrenshow">
        <!--        第一部分-->
        <div v-show="item.indexType=='0'" class="pingjia" v-for="item in formdata.assessRules">
          <div class="pjtitle">{{item.indexName}}</div>
          <div class="xuanxiang" >
            <div v-for="row in item.options">
              <div class="radioxz">
                <span>{{row.optionName}}</span>
                <el-radio v-model="item.value" :label="row.optionValue" disabled>
                  <span v-show="false">11</span>
                </el-radio>
              </div>
            </div>
          </div>
        </div>
        <!--        第二部分-->
        <div class="zhongjian"  v-show="item.indexType=='1'" v-for="item in formdata.assessRules">
          <div class="titletwo">
            {{item.indexName}}
          </div>
          <div>
            <ul v-for="row in item.options">
              <li >
                <el-checkbox disabled v-show="row.other==false" v-model="row.value" >{{row.optionName}}</el-checkbox>

                <span v-show="row.other==true">
                  <el-checkbox v-model="row.value" disabled></el-checkbox>
                  <span class="qita">其他</span>
                  <input type="text" class="inputsr" v-model="row.otherText" disabled>
                  <span>（如选此项，请填写具体内容）</span>
                </span>

              </li>
            </ul>
          </div>
        </div>
        <!--第三部分数据-->
        <div class="bottom" v-show="item.indexType=='2'" v-for="item in formdata.assessRules">
          <div >
            {{item.indexName}}
          </div>
          <textarea disabled maxlength="300" v-model="item.value" name="" id="" cols="30" rows="10" ></textarea>
        </div>
      </div>

      <div v-show="xuanbaShow">
        <table border="1" rules="all" class="tablestyle">
          <thead>
          <tr class="firstHead">
            <th colspan="6">被测评干部的基本情况</th>
            <th  rowspan="2" v-for="item in formdata.assessHead">{{item.indexName}}</th>
          </tr>
          <tr class="twoHead">
            <th>姓名</th>
            <th>性别</th>
            <th>出生年月</th>
            <th>原任职务</th>
            <th>现任职务</th>
            <th>任职时间</th>
          </tr>
          </thead>
          <tbody>
          <tr v-for="item in formdata.assessItems">
            <td>{{item.assessItemName}}</td>
            <td>{{item.sex}}</td>
            <td>{{item.birthDate}}</td>
            <td>{{item.originalPosition}}</td>
            <td>{{item.presentPosition}}</td>
            <td>{{item.positionTime}}</td>

            <td v-for="row in item.assessRules" >
              <el-radio disabled v-model="row.value" v-for="xzrow in row.options"  :label="xzrow.optionValue" @change="jianting(item)">{{xzrow.optionName}}</el-radio>
            </td>
          </tr>
          </tbody>

        </table>
      </div>

      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogYLshow = false">取 消</el-button>
        <el-button type="primary" @click="dialogYLshow = false">确 定</el-button>
      </span>
    </el-dialog>

  </div>
</template>

<script>
import { listProgramme, getProgramme, delProgramme, addProgramme, updateProgramme, exportProgramme, addIndexProgramme } from "@/api/kh/programme";
import BasicQueryForm from '../../components/BasicQueryForm'
import { listIndex } from  "@/api/kh/index";
import request from '@/utils/request'
export default {
  name: "Programme",
  data() {
    return {
      xuanbaShow:false,

      formdata:{
        assessRules:[],
      },
      xunrenshow:false,

      lingdaoShow:false,
      //表头数据
      listLabel: [],
      tableData: [],

      youname:'预览',
      dialogYLshow:false,//预览弹框
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      // 考核方案表格数据
      programmeList: [],
      //考核方案模式字典数据
      patterns: [],

      //考核列表
      AssessmentOptions:[],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      //指标 选中 数组
      indexIds: [],
      // 指标类型 字典数据
      indexTypes:[],
      //考核指标 总条数
      indexTotal:0,
      //指标表格数据
      indexList: [],
      //添加 指标 是否弹出层
      indexOpen: false,
      //弹出层 (指标) 查询参数
      indexQueryParams: {
        pageNum: 1,
        pageSize: 10,
        pattern: undefined,
        programmeId: undefined,
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      // 考核指标 表单参数
      indexProgrammeForm :{},
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      },
      excellentOpen: false,
      deptForExcellentNum:[],
      patternForExcellentNum:0,
      excellentPattern0:0,
    };
  },
  components: {
    'BasicQueryForm' : BasicQueryForm
  },
  created() {
    this.getDicts("kh_index_type").then(response => {
      this.indexTypes = response.data;
    });
    this.getDicts("kh_programme_type").then(response =>{
      this.patterns = response.data;
    });
  },
  methods: {
    setExcellentNum(row) {
      const id = row.assessmentId
      request({
        url: '/kh/assessment/assessdept/'+id,
        method: 'get',
      }).then(response => {
        this.deptForExcellentNum = response.data
        this.excellentOpen  = true;
        this.patternForExcellentNum = row.pattern
        this.excellentPattern0 = this.deptForExcellentNum[0].excellentPattern0
      });
    },
    handleExcellentPattern0Change(){
      this.deptForExcellentNum.forEach(item=> item.excellentPattern0 = this.excellentPattern0)
    },
    submitFormForExcellentNum(){
      request({
        url: '/kh/assessment/saveassessdept',
        method: 'post',
        data:this.deptForExcellentNum
      }).then(response => {
        this.excellentOpen  = false;
      });
    },
    cancelForExcellentNum(){
      this.excellentOpen  = false;
    },
    getListByQueryForm(){
      this.$refs.queryForm.pageQuery(this.queryParams)
    },
    //预览
    yulan:function(row){
      console.log('1111',row)
      debugger
      this.youname = row.programmeName
      this.dialogYLshow=true
      if(row.pattern=='0' || row.pattern=='1'){
        this.lingdaoShow = true
        this.xunrenshow = false
        this.xuanbaShow = false
        this.getListld(row.id)
      }
      if(row.pattern=='2'){
        this.lingdaoShow = false
        this.xunrenshow = true
        this.xuanbaShow = false
        this.getListxr(row.id)
      }
      if(row.pattern=='3'){
        this.lingdaoShow = false
        this.xunrenshow = false
        this.xuanbaShow = true
        this.getListxr(row.id)
      }

    },
    //计算
    doStatistic(row) {
      this.$confirm('是否确认计算已评分的结果?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function() {
        return request({
          url: '/kh/statistic/statistic/' + row.id,
          method: 'get',
        });
      }).then(() => {
        this.$message.success("计算成功");
      }).catch(function() {});
    },
    //获取列表数据
    getListld:function(id) {
      request({
        url: '/kh/fe/programme/'+id,
        method: 'get',
      }).then(response => {
        this.listLabel = response.data.assessRules
        this.tableData = response.data.assessItems
        for (var i=0;i<this.tableData.length;i++){
          this.hejiSum(this.tableData[i],this.tableData[i].length)
        }

      });
    },
    //获取选人用人
    getListxr:function(id) {
      request({
        url: '/kh/fe/programme/'+id,
        method: 'get',
      }).then(response => {
        this.formdata = response.data
      });
    },
    //合计总分
    hejiSum:function(arr,leg) {
      var kongSum=0
      for (var i=0;i<arr.length-1;i++){
        if (!isNaN(Number(arr[i].value))) {
          kongSum = kongSum + arr[i].value*1
        }

      }
      arr[leg-1].value =kongSum
    },

    /** 查询考核方案列表 */
    getList(queryParams) {
      this.queryParams.pageNum = queryParams.pageNum;
      this.queryParams.pageSize = queryParams.pageSize;
      this.loading = true;
      listProgramme(queryParams).then(response => {
        this.programmeList = response.rows;
        this.total = response.total;
        this.AssessmentOptions = this.$refs.queryForm.AssessmentOptions;
        this.loading = false;
      });
    },
    // 字典状态字典翻译
    patternFormat(row, column) {
      return this.selectDictLabel(this.patterns, row.pattern);
    },
    //加入方案 按钮
    addIndexProgramme(row){
      var that = this
      var row1={ pattern:this.indexQueryParams.pattern,id:this.indexQueryParams.programmeId};
      this.indexProgrammeForm.indexId=row.indexId;
      this.indexProgrammeForm.programmeId=this.indexQueryParams.programmeId;
      this.indexProgrammeForm.indexType=row.indexType;
      this.indexProgrammeForm.indexName = row.indexName;
      if(row.indexType == 3){
        //数值指标加入
        this.$prompt('请输入指标的分值权重','提示',{
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          inputPattern:/^[1-9]\d{0,2}$/,
          inputErrorMessage: '只能输入数字'
        }).then(({value}) =>{
          // 调用添加 方案与指标关系 接口（数值指标）
          this.indexProgrammeForm.level=value;
          addIndexProgramme(this.indexProgrammeForm).then(response =>{
            if(response.code===200){
              this.addIndex(row1);
              this.msgSuccess("加入成功");
            }else {
              this.msgError("加入失败");
            }
          });
        });
      }else {
        //非数值指标 加入
        addIndexProgramme(this.indexProgrammeForm).then(response =>{
          if(response.code===200){
            this.addIndex(row1);
            this.msgSuccess("加入成功");
          }else {
            this.msgSuccess("加入失败");
          }
        });
      }
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    //考核指标 弹框 取消按钮
    indexCancel() {
      this.indexOpen = false;
      this.indexList =[];
     // this.reset();
    },
    // 字典状态字典翻译
    dictDataFormat(row, column) {
      return this.selectDictLabel(this.indexTypes, row.indexType);
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        programmeName: undefined,
        assessmentId: undefined,
        endTime: undefined,
        pattern: undefined,
        scoreInterval: undefined,
        excellentRatio: undefined,
        explainText: undefined,
        delFlag: undefined,
        createBy: undefined,
        createTime: undefined,
        updateBy: undefined,
        updateTime: undefined
      };
      this.resetForm("form");
    },

    //考核指标 弹框 多选框选中数据
    handleSelectionChangeIndex(selection) {
      this.indexIds = selection.map(item => item.id)
      this.single = selection.length!=1
      this.multiple = !selection.length
      // console.log(this.indexIds)
    },

    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },
    //考核方案监听
    khfa:function(row){
      console.log(row)
      if(row==0){
        this.form.scoreInterval = '100-90,89-75,74-60,59-0';
        this.form.excellentRatio = 20
        this.form.explainText = '1.本表为无记名投票；2.总分100分，90分以上为优秀；得分在75--89分的为良好；得分在60--74分的为合格；得分在59分以下的为较差；3.每一小项得分为权重分值；4.得分合计不能为100分或0分，否则为废票；5.优秀比例不超过20%，本表应评优秀个数1个；6.考核年度内受处分的党员不能评为优秀'
      }
      if(row==1){
        this.form.scoreInterval = '100-90,89-75,74-60,59-0';
        this.form.excellentRatio = 20
        this.form.explainText = '1.本表为无记名投票；2.总分100分，90分以上为优秀；得分在75--89分的为良好；得分在60--74分的为合格；得分在59分以下的为较差；3.每一小项得分为权重分值；4.得分合计不能为100分或0分，否则为废票；5.优秀比例不超过20%，本表应评优秀个数1个；6.考核年度内受处分的党员不能评为优秀'
      }
      if(row==2){
        this.form.scoreInterval = '100,60,0,1';
        this.form.excellentRatio = 20
        this.form.explainText = '第1–5项请在所选择答案后面的圆圈内勾选。'
      }
      if(row==3){
        this.form.scoreInterval = '100,60,0,1';
        this.form.excellentRatio = 20
        this.form.explainText = '对所列干部的选拔任用有何看法，请在相关项目内勾选'
      }
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.form.pattern=0
      this.form.assessmentId = this.$refs.queryForm.queryParams.assessmentId;
      this.form.scoreInterval = '100-90,89-75,74-60,59-0';
      this.form.excellentRatio = 20
      this.form.explainText = '1.本表为无记名投票；2.总分100分，90分以上为优秀；得分在75--89分的为良好；得分在60--74分的为合格；得分在59分以下的为较差；3.每一小项得分为权重分值；4.得分合计不能为100分或0分，否则为废票；5.优秀比例不超过20%，本表应评优秀个数1个；6.考核年度内受处分的党员不能评为优秀'
      this.open = true;
      this.title = "添加考核方案";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getProgramme(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改考核方案";
      });
    },
    /** 可添加指标 按钮 */
    addIndex(row){
      this.indexQueryParams.programmeId=row.id;
      this.addIndexPage();
    },
    /** 可添加指标 分页方法 */
    addIndexPage(){
      request({
        url: '/kh/khProgrammeIndex/canAddList',
        method: 'get',
        params: this.indexQueryParams
      }).then(response=>{
        this.indexList=response.rows;
        this.indexTotal = response.total;
      });
      this.indexOpen=true;
      this.title = "添加考核指标";
    },

    /** 提交按钮 */
    submitForm: function() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != undefined) {
            updateProgramme(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("修改成功");
                this.open = false;
                this.getListByQueryForm();
              } else {
                this.msgError(response.msg);
              }
            });
          } else {
            addProgramme(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("新增成功");
                this.open = false;
                this.getListByQueryForm();
              } else {
                this.msgError(response.msg);
              }
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {

      let rowsDeleted = this.$CrudUtils.rowsDeleted(
        row, this.ids, this.programmeList, o=>o.id, o=>o.programmeName
      )
      this.$confirm('是否确认删除考核方案[ ' + rowsDeleted.msgs + ' ]', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delProgramme(rowsDeleted.ids);
        }).then(() => {
          this.getListByQueryForm();
          this.msgSuccess("删除成功");
        }).catch(function() {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.$refs.queryForm.queryParams;
      this.$confirm('是否确认导出所有考核方案数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return exportProgramme(queryParams);
        }).then(response => {
          this.download(response.msg);
        }).catch(function() {});
    }
  }
};
</script>
<style lang="scss">
  .app-container .tablestyle {
    border: 1px solid #cccccc;
    color: #606266;
    font-size: inherit;
    width: 95%;
    margin: auto;
  }
  .app-container .tablestyle td {
    height: 34px;
    text-align: center;
  }
  .app-container .divbody {
    border: 1px solid #cccccc;
    max-height: 700px;overflow: auto;
    .pingjia {
      width: 100%;
      div {
        height: 36px;
        line-height: 36px;
      }
      .pjtitle {
        border-top:1px solid #cccccc;
        padding-left: 10px;
      }
      .xuanxiang {

        display: flex;
        justify-content: space-around;
        border-top: 1px solid #cccccc;
        div {
          width: 100%;
          text-align: center;
        }
        .radioxz{
          border-right: 1px solid #cccccc;
          display: flex;
          justify-content: space-around;
          align-items: center;
        }
      }
    }
  }
  .app-container .zhongjian {
    width: 100%;
    border-top:1px solid #cccccc;
    .titletwo {
      height: 30px;
      line-height: 30px;
      padding-left: 10px;
    }
    ul {
      margin: 0;
      padding: 0;


    }
    li {
      height: 25px;
      line-height: 25px;
      font-size: 14px;
      padding-left: 33px;
      list-style:none;
      color: #606266;
    }
    .inputsr {
      border: none;
      border-bottom:1px solid black;
      margin-left: 5px;
      outline:none
    }
    .qita {
      margin-left: 13px;
    }
  }
  .app-container .bottom {
    padding-left: 10px;
    width: 100%;
    border-top:1px solid #cccccc;
    div {
      height: 36px;
      line-height: 36px;
    }
    textarea {
      border: none;
      width: 100%;
      outline:none;
    }
  }


</style>
